<?php
/**
 * Created by PhpStorm.
 * User: hisheng
 * Date: 2017/6/7
 * Time: 18:59
 */
namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Support\Facades\Session;

class IndexController extends Controller
{
    public $user;
    public function __construct(User $user)
    {
        $this->user = $user;
    }
    
    public function init(){
        $user_id = Session::get('user_id');
        $data = [];
        $data['init'] = 1;
        if($user_id){
            $userDetail= $this->user->find($user_id);
            if($userDetail){
                $data['user'] = $userDetail;
            }
        }
        return $this->json($data);
    }
}